import request from './request.js'

const key = '6e136f9b1a7fb205180fe7d987ff84d1'

export const getWeatherByIp = () => {
    return request({
      method: 'GET',
      url: `/ip?&key=${key}`,
    })
}

export const getCode = (city) => { 
    return request({
      method: 'GET',
      url: `/geocode/geo?address=${city}&key=${key}`,
    })
}

export const getCurrentWeather = (code) => { 
    return request({
      method: 'GET',
      url: `/weather/weatherInfo?city=${code}&key=${key}&extensions=base`,
    })
}

export const getForecastWeather = (code) => { 
    return request({
      method: 'GET',
      url: `/weather/weatherInfo?city=${code}&key=${key}&extensions=all`,
    })
} 